{% extends 'admin/dashboard.html' %}

{% block content %}
<div class="card">
    <h2 class="text-xl font-bold mb-4">招聘列表</h2>
    <a href="{{ url_for('admin_jobs_add') }}" class="inline-block mb-4 px-4 py-2 bg-primary text-white rounded">添加职位</a>
    <table class="min-w-full divide-y divide-gray-200">
        <thead class="bg-gray-50">
            <tr>
                <th scope="col" class="table-header">职位名称</th>
                <th scope="col" class="table-header">部门</th>
                <th scope="col" class="table-header">工作地点</th>
                <th scope="col" class="table-header">操作</th>
            </tr>
        </thead>
        <tbody class="bg-white divide-y divide-gray-200">
            {% for job in jobs %}
            <tr>
                <td class="table-data">{{ job.title }}</td>
                <td class="table-data">{{ job.department }}</td>
                <td class="table-data">{{ job.location }}</td>
                <td class="table-data">
                    <!-- 假设编辑路由为 admin_jobs_edit，删除路由为 admin_jobs_delete -->
                    <a href="{{ url_for('admin_jobs_edit', id=job.id) }}" class="text-primary hover:text-primary/80">编辑</a>
                    <a href="{{ url_for('admin_jobs_delete', id=job.id) }}" class="text-red-500 hover:text-red-700 ml-2">删除</a>
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
</div>
{% endblock %}